<?php if (!defined('SHUIPF_VERSION')) exit(); ?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "/www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="/www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

	<title>购物车 - <if condition=" isset($SEO['title']) && !empty($SEO['title']) ">{$SEO['title']}</if>{$SEO['site_title']}</title>
	<meta name="description" content="{$SEO['description']}" />
	<meta name="keywords" content="{$SEO['keyword']}" />

	<link href="favicon.ico" rel="shortcut icon" />
	<link rel="canonical" href="{$config_siteurl}" />
	<link href="{$config_siteurl}statics/nhjhouse/css/styles.css" rel="stylesheet" type="text/css" />
	<link href="{$config_siteurl}statics/nhjhouse/css/lightbox2.css" rel="stylesheet" type="text/css" />
	<script type="text/javascript" src="{$config_siteurl}statics/nhjhouse/js/jquery.min.js"></script>
	<script type="text/javascript" src="{$config_siteurl}statics/nhjhouse/js/jquery.validate.pack.js"></script>
	<script type="text/javascript" src="{$config_siteurl}statics/nhjhouse/js/jquery.lightbox.js"></script>
	<script type="text/javascript">
		var price = {$data.nowprice};
		$(document).ready(function(){
			$('#group_num').keyup(function() {
				if($('#group_num').val() == "0"){
					$('#group_num').val('1');
					alert('购买数量不得小于1');
				}
				updateform();
			});
			$('#plus').click(function() {
				$('#group_num').val(parseInt($('#group_num').val())+1);
				updateform();
			});
			$('#minus').click(function() {
				$('#group_num').val(parseInt($('#group_num').val())-1);
				if($('#group_num').val() == "0"){
					$('#group_num').val('1');
					alert('购买数量不得小于1');
				}
				updateform();
			});
			$('#remark').bind('focus keyup input paste',function(){
				$maxNum = 110;
				$maxTxt = $(this).attr("value");
				if($maxTxt.length > $maxNum){
					$(this).html($maxTxt.substring(0,$maxNum));
				}else{
					$('#numfont').text($maxNum - $maxTxt.length);
				}
			});
			$("#formMsg").validate({
				rules:{
					truename:{required:true},
					phone:{required:true}
				},
				messages:{
					truename:{required:'请输入姓名'},
					phone:{required:'请输入电话'}
				}
			});
		});
		function updateform(){
			$('#num').val($('#group_num').val());
			$('#subtotal').text('￥'+$('#group_num').val()*price);
			$('#total_order').text('￥'+$('#group_num').val()*price);
			$('#price').val($('#group_num').val()*price);
		}
	</script>
</head>
<body>
	<template file="Buy/header.php"/>
<div id="box">

	<div class="mainbox clearfix">
		<div class="maininfo lf">
			<div class="box-top2"></div>
			<div class="sect">
				<h1 class="title2" style="margin-bottom:5px;">提交订单</h1>
				<table class="dataTab carttable" width="100%">
					<tr>
						<th height="40">项目</th>
						<th>数量</th>
						<th>&nbsp;</th>
						<th>价格</th>
						<th>&nbsp;</th>
						<th>总价</th>
					</tr>
					<tr>
						<td align="left" width="300">{$data.title}</td>
						<td align="center">
							<div id="Numinput" class="clearfix">
								<input type="text" value="1" id="group_num" class="txt lf" size="5" style="width:45px;text-align:center;font-weight:bold;"/>
								<a href="javascript:void(0);" rel="add" class="numadjust add" id="plus" target="_self"></a>
								<a href="javascript:void(0);" rel="del" class="numadjust del" id="minus" target=="_self"></a>
							</div> <font id='limitnum' style="color:#F00"></font>
						</td>
						<td align="center">x</td>
						<td align="center" id='goods_price'>¥{$data.nowprice}</td>
						<td align="center" width="20">=</td>
						<td align="center" width="100"> <strong id='subtotal'>¥{$data.nowprice}</strong>
						</td>
					</tr>
					<tr>
						<td> <b>快递：</b>
						</td>
						<td colspan="3" align="center"> <font color="#E95C10" id="free_money"></font>
						</td>
						<td align="center">=</td>
						<td align="center"> <strong id="shipping_fee">¥0</strong>
						</td>
					</tr>
					<tr>
						<td> <b>订单总额：</b>
						</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td>&nbsp;</td>
						<td align="center">=</td>
						<td align="center">
							<strong id="total_order" class="c1" style="font-size:18px;">¥{$data.nowprice}</strong>
						</td>
					</tr>
				</table>

				<h1 class="title2" style="margin-bottom:20px;">付款人信息</h1>
				<form action="{:U('Buy/Index/createOrder')}" method="post" name="formMsg" id="formMsg">
					<input type="hidden" name="num" id="num" value="1"/>
					<input type="hidden" name="price" id="price" value="{$data.nowprice}"/>
					<input type="hidden" name="goodsid" value="{$data.id}" />
					<input type="hidden" name="uid" value="{$uid}"/>
					<table class="dataTab" width="100%">
						<tr>
							<td align="right" valign="top" width="120">
								<strong><font color="red">*</font>姓名</strong>
							</td>
							<td>
								<input type="text" value="" name="truename" class="txt" id="truename" />
							</td>
						</tr>
						<tr>
							<td align="right" valign="top" width="120">
								<strong><font color="red">*</font>手机号</strong>
							</td>
							<td>
								<input type="text" value="" name="phone" class="txt" id="phone" />
							</td>
						</tr>
						<tr>
							<td align="right" valign="top">
								<strong>附言</strong>
							</td>
							<td>
								<textarea name="remark" style="height:60px;" class="area" cols="90" id="remark"></textarea>
								<p style="color:#666;">
											您最多输入110个汉字，还可以输入 <b><font color="#ff0000" id="numfont">110</font></b>
											个字
										</p>
						</td>
					</tr>
					<tr>
						<td></td>
						<td>
							<input type="submit" class="but" value="确认无误提交" />
						</td>
					</tr>
				</table>
			</form>
		</div>

		<div class="box-bottom2"></div>
	</div>

	<div class="sidebox rf">
		<div class="sideblock side-flow">
			<div class="sbox-top"></div>
			<div class="sidemain">
				<h1 class="title2">账户余额</h1>
				<p>
					您的帐户余额：
					<span>¥{$User.amount}</span>
				</p>
			</div>
			<div class="sbox-bottom"></div>
		</div>

	</div>

</div>

</div>
<div class="wrap">
<template file="Buy/footer.php"/>
</div>
</body>
</html>